
keep if  ( index>=-12 & index<=20 ) & ivsample==1

capture frame drop results
frame create results str10 outcomevar evicted notevicted time

foreach var of varlist autoloan creditscore deliquency finindex totbalcollect zerorevolving {

reg `var' evictionorder qdum2-qdum33 evictXq2-evictXq33 i.courttime i.courtq 
		
*Calculate omitted group baseline mean
sum `var' if evictionorder==0 & index==-12  & e(sample)==1
local basemean=r(mean)
		
* adding period 1 (first) estimates
local rel_q=1-13
local qplot=`rel_q' 
local noevictplot= `basemean'
local evictplot=`basemean'+ _b[evictionorder] 	
frame post results ("`var'")  (`evictplot') (`noevictplot') (`qplot')
	
foreach num of numlist 2(1)33 {
			local rel_q=`num'-13
			local qplot=`rel_q' 
			local noevictplot= `basemean'+_b[qdum`num']
			local evictplot=`basemean'+ _b[evictionorder]+_b[qdum`num']+_b[evictXq`num'] 
			frame post results ("`var'")  (`evictplot') (`noevictplot') (`qplot')
}
		
}

frame results: save  ${Inputs}\NY_credit_eventstudy, replace
